
<ui:composition  xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:f="http://java.sun.com/jsf/core"
                 template="template.xhtml"
                 xmlns:c="http://java.sun.com/jsp/jstl/core"
                 xmlns:ice="http://www.icesoft.com/icefaces/component">
    <!--
    
    xmlns:p="http://primefaces.prime.com.tr/ui"
    -->
    <ui:param name="title" value="News feed"/>

    <ui:define name="content">

        <div class="content">

            <div class="content-left">
                <c:forEach var="news" items="${newsBackBean.news}">
                    <ice:graphicImage width="20px"
                                      url="achi_img/#{news.value.image}"
                                      alt="#{news.value.title_sv}"/>
                    <h:outputText value="#{news.value.title_sv}"/>
                    <br/>
                </c:forEach>
            </div>
            <div class="content-right">
                <b><u>Targeted Achievements</u></b>
                <h:form>
                    <ice:panelGroup>
                        <hr/>

                        <c:forEach var="achi" items="${newsControlBean.targets}">
                            <ice:panelGroup styleClass="achi-box-out"
                                            effect="#{effectBean.currentEffectt3}">
                                <ice:panelGroup id="p#{achi.key}"
                                                dropValue="#{achi.key}" 
                                                dropTarget="true"
                                                draggable="#{achi.value.id ne '0'}" 
                                                dragListener="#{newsControlBean.targetMovedListener}"
                                                dragOptions="dragGhost"
                                                dragMask="dragging"
                                                dropMask="dragging,hover_start,hover_end"
                                                dragValue="#{achi.value}"
                                                panelTooltip="#{achi.key}">

                                    <ice:graphicImage visible="true"
                                                      width="50px"
                                                      url="achi_img/#{achi.value.image}"
                                                      alt="#{achi.value.title_sv}"
                                                      style="margin-left:5px;margin-top:5px;"/>
                                </ice:panelGroup>
                            </ice:panelGroup>

                            <ice:panelTooltip id="#{achi.key}"
                                              style="width: 200px;"
                                              displayOn="click"
                                              hideOn="mousedown">
                                <f:facet name="header">
                                    #{achi.value.title_sv}
                                </f:facet>
                                <f:facet name="body">
                                    #{achi.value.desc_sv}
                                </f:facet>
                            </ice:panelTooltip>

                        </c:forEach>
                    </ice:panelGroup>




                </h:form>

                <br/><br/><br/><br/><br/><br/><br/>
                <b><u>Done Achievements</u></b>
                <h:form>
                    <!-- selectInputText showing panel grid list of items. -->
                    <ice:panelGroup>
                        <hr/>
                        <!-- Drop Target 1 -->
                        <!-- style="margin:10px; padding:10px; width:100px; height:100px; background-color:orange; color:white; float: left;" -->

                        <c:forEach var="cAchi" items="${newsControlBean.completed}">

                            <h:panelGroup styleClass="achi-box-out">
                                <ice:panelGroup dropValue="#{cAchi.key}" 
                                                dropTarget="true"
                                                draggable="#{cAchi.value.achievement.id ne '0'}" 
                                                dragListener="#{newsControlBean.completeMovedListener}"
                                                dragOptions="dragGhost"
                                                dragMask="dragging"
                                                dropMask="dragging,hover_start,hover_end"
                                                dragValue="#{cAchi.value}">

                                    <!--<h:outputLink value="testar?completedAchi=#{cAchi.value.id}">-->
                                    <h:form onclick="ajax.tst()">
                                        <input id="test" value="save" type="submit" />
                                        <ice:graphicImage visible="true"
                                                          width="50px"
                                                          url="achi_img/#{cAchi.value.achievement.image}"
                                                          alt="#{cAchi.value.id}"
                                                          style="margin-left:5px;margin-top:5px;"/>
                                    </h:form>


                                    <h:commandLink actionListener="#{newsControlBean.openPopup}"></h:commandLink>                                   

                                </ice:panelGroup>
                            </h:panelGroup>

                            <ice:panelTooltip id="#{cAchi.key}"
                                              style="width: 200px;"
                                              displayOn="hover"
                                              hoverDelay="100">
                                <f:facet name="header">
                                    #{cAchi.value.achievement.title_sv}
                                </f:facet>
                                <f:facet name="body">
                                    #{cAchi.value.description}
                                    <h:commandLink value="LINK" action="#{newsControlBean.redirectComplete}">
                                        <f:param name="id" value="#{cAchi.value.id}"/>
                                    </h:commandLink>

                                    <a href="test?completedAchi=#{cAchi.key}">View</a>
                                    <a href="test?achi=#{cAchi.key}">Edit</a>
                                </f:facet>
                            </ice:panelTooltip>


                            <ice:panelPopup visible="false"
                                            rendered="true"
                                            modal="true"
                                            autoCentre="true"
                                            positionOnLoadOnly="false"
                                            style="width:400px;">
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:panelGroup  style="float: left;">
                                            #{cAchi.value.achievement.title_sv}
                                        </h:panelGroup>
                                        <h:panelGroup style="float: right;">
                                            <h:commandButton image="achi_img/cross.jpg"
                                                             alt="Close" title="Close"
                                                             style="height: 11px; width: 11px; border: 0;"
                                                             actionListener="#{newsControlBean.closePopup}"/>
                                        </h:panelGroup>
                                    </h:panelGroup>
                                </f:facet>
                                <f:facet name="body">
                                    <h:panelGroup>
                                        #{cAchi.value.achievement.image} - #{cAchi.value.date_completed} - #{cAchi.value.description}
                                    </h:panelGroup>
                                </f:facet>
                            </ice:panelPopup>


                        </c:forEach>
                    </ice:panelGroup>
                </h:form>
                
            </div>
        </div>
        
        <h:commandButton id="test" value="test" onclick="ajax.tst()" />
        
    </ui:define>

</ui:composition>